/****************************************************
    Author:            龙之介
    CreatTime:    #CreatTime#
    Description:     Nothing
*****************************************************/

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;
using ZYKTool;
using System.Linq;



namespace LongZhiJie
{
    public class Gun3 : Gun基本属性
    {
        #region 常量
        #endregion

        #region 事件
        #endregion

        #region 字段
        #endregion


        #region 属性 
        #endregion


        #region 方法 
        #endregion

        #region Unity回调
        #endregion

        #region 事件回调
        #endregion

        #region 帮助方法
        #endregion
        public override void Attack()
        {
            //
            //Debug.LogError("attack" + 3);
            // Instantiate(_shotEffect, _shotPoint.position, Quaternion.identity);

            int j = 0;
            //Vector3 dir = (TapTapStaticValue.Player.transform.position - transform.position).normalized;
            for (int i = 0; i < Count; i++, j++)//散弹枪
            {
                // Debug.LogError(transform.rotation);
                GameObject go = Instantiate(_projectile, _shotPoint.position, _shotPoint.rotation) ;

                // bullet.transform.LookAt(bullet.transform.position + bullet.transform.right);

               Projectile  bullet = go.GetOrAddComponent<Projectile>();
                bullet.damage = Damage; 
                bullet.speed = 50;
                bullet.lifeTime = 0.5f;
                //   go.transform.LookAt(go.transform.position + go.transform.right);
                go.transform.Rotate(new Vector3(0, 0, j * 10));
                //go.transform.position += go.transform.forward * 0.3f;
                //go.GetComponent<Rigidbody>().velocity = go.transform.forward * speed;
            }

        }

        public override void Init(GameObject projectile, GameObject shotEffect, Transform shotPoint)
        {
            base.Init(projectile, shotEffect, shotPoint);
        }
    }
}